'''
Created on 31/07/2011

@author: Digao
'''
def toInt(arg):
    return int(arg)

def main():

    input = open('input.in')
    CASES = int(input.readline())
    for case in range(1,CASES+1):
        words = input.readline().strip().split(' ')
        words.reverse()
        ansStr = ' '.join(words)
        ans = 'Case #%d: %s'%(case,ansStr)
        print ans


if __name__ == '__main__':
    main()
